package com.nine.pattern.builder.demo1;

/**
 * @author nine
 * @version 1.0
 * @description 指挥者类
 * @date 2024-07-03 22:59
 */
public class Director {

	private Builder builder;

	public Director(Builder builder) {
		this.builder = builder;
	}

	// 构建自行车，此方法也可以整合到 Builder 中，但是就违反了单一职责原则，加重抽象建造者的职责，如果 construct 过于复杂，还是建议单独抽取出来
	public Bike construct() {
		builder.buildFrame();
		builder.buildSeat();
		return builder.createBike();
	}

}
